package com.whl.cloud.oauth;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.whl.cloud.fergn.UserCenter;
import com.whl.cloud.model.PermissionResult;

@Component
public class PermissionServiceImpl {
	@Autowired
	UserCenter userCenter;

	public String[] anonymous() {
		List<PermissionResult> results = userCenter.anonymous();
		String[] anonymouses = new String[results.size()];
		results.stream().map(result -> result.getCode()).collect(Collectors.toList()).toArray(anonymouses);
		return anonymouses;
	}

	public String[] authority() {
		List<PermissionResult> results = userCenter.authority();
		String[] authoritys = new String[results.size()];
		results.stream().map(result -> result.getCode()).collect(Collectors.toList()).toArray(authoritys);
		return authoritys;
	}

}
